package apIExercise.exception;

import java.io.*;
import java.util.Scanner;

public class PWDemo {
    public static void main(String[] args) throws IOException {
        /*
        FileOutputStream fos=new FileOutputStream("dd.txt");
        OutputStreamWriter osw=new OutputStreamWriter(fos);
        BufferedWriter bow=new BufferedWriter(osw);
        PrintWriter pw=new PrintWriter(bow);
        //bow.write("afaisaq");
        //bow.write("阿芬爱上了阿强");
        pw.println("此生无悔入不良");
        pw.println("路飞是要成为海贼王的男人");
        System.out.println("写出完毕！");
        bow.close();

         */
        FileOutputStream fos=new FileOutputStream("dad.txt");
        OutputStreamWriter osw=new OutputStreamWriter(fos);
        BufferedWriter bw=new BufferedWriter(osw);
        PrintWriter pw=new PrintWriter(bw,true);
        Scanner scan=new Scanner(System.in);
        System.out.println("请输入一组数,单独输出exit时就结束：");
        while (true){
            String line=scan.nextLine();
            if(line.equals("exit")){
                System.out.println("结束输入");
                break;
            }else {
                pw.println(line);
                System.out.println("请继续输入：");
            }
        }
        pw.close();

    }
}
